package com.restaurant.controller;

import com.restaurant.bean.ResponseResult;
import com.restaurant.service.DataAnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("data")
public class DataAnalysisController {
    @Autowired
    private DataAnalysisService dataAnalysisService;

    @GetMapping("typesWithTotal")
    public ResponseResult typesWithTotal(String[] date) {
        return ResponseResult.success(dataAnalysisService.getTypesWithTotal(date));
    }

    @GetMapping("types")
    public ResponseResult types() {
        return ResponseResult.success(dataAnalysisService.getTypes());
    }

    @GetMapping("allConsumption")
    public ResponseResult allConsumption() {
        return ResponseResult.success(dataAnalysisService.getAllConsumption());
    }

    @GetMapping("costPerformance")
    public ResponseResult costPerformance(String type) {
        return ResponseResult.success(dataAnalysisService.getCostPerformance(type));
    }

    @GetMapping("area")
    public ResponseResult area() {
        return ResponseResult.success(dataAnalysisService.area());
    }


    @GetMapping("lngAndLat")
    public ResponseResult lngAndLat(String type) {
        return ResponseResult.success(dataAnalysisService.getLngAndLat(type));
    }

}
